//
//  UIButton+Extension.swift
//  sinaweibo
//
//  Created by WGP on 16/4/14.
//  Copyright © 2016年 WGP. All rights reserved.
//

import UIKit

extension UIButton
{
    convenience init(image: String, bgImage: String = "timeline_card_bottom_background", title: String, fontSize: CGFloat = 12)
    {
//        调用指定构造方法
        self.init(frame: CGRectZero)
//        self.init()
        
        setBackgroundImage(UIImage(named: bgImage), forState: .Normal)
        setBackgroundImage(UIImage(named: "\(bgImage)_highlighted"), forState: .Highlighted)
        
        setImage(UIImage(named: image), forState: .Normal)
        
//        设置标题
        setTitle(title, forState: .Normal)
        
//        设置文字大小和颜色
        setTitleColor(UIColor.lightGrayColor(), forState: .Normal)
        titleLabel?.font = UIFont.systemFontOfSize(fontSize)
     
        
    }
}